const usePlmFabricBoardStore = defineStore('usePlmFabricBoardStore', {
	state: () => ({
		imgsOnLeftBoard: []
	}),
	actions: {
		// 一次性替换图片集合
		setAllImgsOnce(data) {
			this.clearImgsBoard()
			if (this.imgsOnLeftBoard.length == 0) {
				this.imgsOnLeftBoard = data
			} else {
				this.clearImgsBoard()
				this.imgsOnLeftBoard = data
			}
		},
		// 向图片集何中追加一个图片
		addOneImgToBoard(data) {
			this.imgsOnLeftBoard.push(data)
		},
		// 清空图片集合
		clearImgsBoard() {
			this.imgsOnLeftBoard.splice(0)
		},
		// 更新一个图片
		setImgChanged(index, data) {
			this.imgsOnLeftBoard[index] = data
		},
		// 删除一个图片
		removeOneImg(index) {
			this.imgsOnLeftBoard.splice(index, 1)
		}
	}
})

export default usePlmFabricBoardStore
